<?php $this->load->view('header');?>
<div class="row-bids">
	<div class="container">
		<div class="row">
			<div class="col-lg-12 col-md-12 title-unregister-invite ">
				<div class="col-lg-9 col-md-9 slogan-unregister">
					<div class="text-center">You're almost there</div>
					<div class="text-center">Just create an account to contact this freelancer.</div>
				</div>
				<div class="col-lg-3 col-md-3">
					<div class="text-right"><b>Looking for work?</b></div>
					<div class="text-right">
						<a href="<?php echo site_url('buyer/signUp');?>">Sign up as a freelancer</a>
					</div>
				</div>
			</div>

			<div class="col-lg-12 col-md-12 space-margin-bottom">
				<div class="col-lg-5 col-md-5 col-lg-offset-2 col-md-offset-2 no-padding border-infor-freelancer">
				<?php
					if(isset($freelancer_info)){
				?>
					<div class="col-lg-4 col-md-4">
						<img class="img-responsive" src="<?php if ($freelancer_info->row()->logo != '') echo uimage_url($freelancer_info->row()->logo); else echo image_default(); ?>">	
					</div>
					<div class="col-lg-8 col-md-8">
						<div class="name-invite-freelancer"><?php echo $freelancer_info->row()->user_name;?></div>
						<div><?php echo getCategoryLinks($freelancer_info->row()->user_categories);?></div>
					</div>
				<?php
					}
				?>
					
				</div>
				
			</div>

			<div class="col-lg-12 col-md-12 space-margin-bottom">
				<div class="col-lg-5 col-md-5 col-lg-offset-2 col-md-offset-2 no-padding app-form-style">
					<form class="form-horizontal" method="POST" action="<?php echo site_url('buyer/signUp');?>" id="form-register-invite-freelancer" role="form">
					<fieldset class="scheduler-border">
						<legend class="scheduler-border">Sign up to invite Freelancer</legend>  
						<div class="form-group">
						    <div class="col-sm-10 space-margin-left">
						      <input type="email" class="form-control" id="email" name="email" placeholder="Email">
						    </div>
						</div>
						<div class="form-group">
						    <div class="col-sm-10 space-margin-left">
						      <input type="text" class="form-control" id="username" name="username" placeholder="Username">
						    </div>
						</div>
						<div class="form-group">
						    <div class="col-sm-10 space-margin-left">
						      <input type="password" class="form-control" id="password" name="password" placeholder="Password">
						    </div>
						</div>
						<div class="form-group">
						    <div class="col-sm-10 space-margin-left">
						      <input type="password" class="form-control" id="confirm-password" name="confirm-password" placeholder="Confirm Password">
						    </div>
						</div>
						<div class="form-group">
						    <div class="col-sm-10 space-margin-left">
						    <label class="col-lg-5 col-md-5 no-padding"><?php echo $this->lang->line("I'm looking for")?></label>
						    	<input checked="checked" name="role_id" type="radio" value="1"> 
						    <label style="font-size:17px"><?php echo $this->lang->line('Hire');?></label>
						    </div>
						</div>

						<div class="form-group">
							<div class="col-sm-10 space-margin-left">
						      <label>Have you have an account ? <a href="#" data-url="<?php echo getUrl();?>" class="sign-up-invite">Sign up here</a></label>
						    </div>
						</div>
						  
						<div class="form-group">
						    <div class="col-sm-10 space-margin-left">
						    <!-- <input type="hidden" value="buyerConfirm" name="buyerConfirm" /> -->
						      <button type="submit" value="<?php echo getUrl();?>" name="buyerConfirm" class="btn btn-md btn-primary col-lg-12 col-md-12">Sign in</button>
						    </div>
						</div>
					</fieldset>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
	$(document).ready(function(){
		$("#form-register-invite-freelancer").validate({
            onkeyup : false,
			rules:{
                "email" : {
                    required : true,
                    email : true,
                    minlength:5,
                    remote:{
                        url: "<?php echo site_url('buyer/checkUserEmailInfo');?>",
                        type : "POST",
                    }
                },
                "password" : {
                    required : true,
                    minlength : 8
                },
                "username" : {
                    required : true,
                    minlength :5,
                    remote:{
                        url: "<?php echo site_url('buyer/checkUserNameInfo');?>",
                        type : "POST",
                    }
                },
                "confirm-password" : {
                    equalTo : "#password",
                    required : true,
                }
            },
		    messages:{
		        "email":{
		            required : "<?php echo $this->lang->line('Email')." ".$this->lang->line('required') ?>",
		            email : "<?php echo $this->lang->line('Email')." ".$this->lang->line('valid_email') ?>",
		            minlength : "<?php echo $this->lang->line('Email')." ".$this->lang->line('min_length'); ?>",
		            remote :  "<?php echo $this->lang->line('Email')." ".$this->lang->line('is_unique'); ?>",
		        },
		        "username":{
		            required : "<?php echo $this->lang->line('Username')." ".$this->lang->line('required') ?>",
		            minlength : "<?php echo $this->lang->line('Username')." ". $this->lang->line('min_length'); ?>",
		            remote :  "<?php echo $this->lang->line('Username')." ".$this->lang->line('is_unique'); ?>",
		        },
		        "password":{
		            required : "<?php echo $this->lang->line('Password')." ".$this->lang->line('required') ?>",
		            minlength : "<?php echo $this->lang->line('Password')." ".$this->lang->line('min_length'); ?>"
		        },
		        "confirm-password":{
		            required : "<?php echo $this->lang->line('Confirm Password')." ".$this->lang->line('required') ?>",
		            equalTo : "<?php echo $this->lang->line('Confirm Password')." ".$this->lang->line('matches') ?>",
		            minlength : "<?php echo $this->lang->line('Confirm Password')." ".$this->lang->line('min_length'); ?>"
		        }
		    },
		    submitHandler: function(form) {
			    // do other things for a valid form
			    form.submit();
			  }
		})// end validate form

		// nếu click vào nút sign up
		$('body').on('click','a.sign-up-invite',function(e){
			e.preventDefault();
			var redirect_url = $(this).attr('data-url');
			var html = '<input type="hidden" name="redirect_url_invite" value="' + redirect_url + '">';
			$("#login-popup-form").append(html);
            $("#login-modal").modal('show');
		})
	})
	
</script>
<?php $this->load->view('footer');?>